import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Req, Header, HttpCode } from '@nestjs/common';
import { BossService } from './boss.service';
import { CreateBossDto } from './dto/create-boss.dto';
import { UpdateBossDto, updatePriceBossDto } from './dto/update-boss.dto';

@Controller('boss')
export class BossController {

  constructor(private readonly bossService: BossService) { }
  //新增
  @Post("save")
  @HttpCode(200)
  create(@Body() createBossDto: CreateBossDto) {
    return this.bossService.create(createBossDto);
  }
  //分页查询list
  @Post('list')
  @Header('Content-Type', 'application/json')
  @HttpCode(200)
  async findAll(
    @Body('pageNum') pageNum: number,
    @Body('pageSize') pageSize: number,
    @Body('bossName') bossName: string,
  ) {
    return await this.bossService.findAll(pageNum, pageSize, bossName)
  }
  //详情
  @Post('detail')
  @Header('Content-Type', 'application/json')
  @HttpCode(200)
  findOne(@Body('bossId') bossId: string) {
    return this.bossService.findOne(bossId);
  }

  //更新
  @Post('update')
  @HttpCode(200)
  update(@Body('bossId') bossId: string, @Body('bossName') bossName: string) {
    return this.bossService.update(bossId, bossName);
  }
  //删除
  @Post('remove')
  @HttpCode(200)
  remove(@Body('bossId') bossId: string) {
    return this.bossService.remove(bossId);
  }
  //存单
  @Post('updatePrice')
  @HttpCode(200)
  updatePrice(@Body() updatePriceBossDto: updatePriceBossDto) {
    return this.bossService.updatePrice(updatePriceBossDto);
  }
}
